package com.xianzhiOA.service.impl;/**
 * Created by Administrator on 2017/5/17.
 */

import com.xianzhiOA.bean.XzTempletBaseInfo;
import com.xianzhiOA.bean.XzTempletExtendInfo;
import com.xianzhiOA.dao.XzTempletExtendInfoMapper;
import com.xianzhiOA.service.XzTempletExtendInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 模板扩展实例表
 *
 * @author 王诗博
 * @create 2017-05-17 10:32
 **/
@Service("XzTempletExtendInfoService")
public class XzTempletExtendInfoServiceImpl implements XzTempletExtendInfoService {
    @Autowired
    private XzTempletExtendInfoMapper xzTempletExtendInfoMapper;

    //添加扩展实例
    @Override
    public int insert(XzTempletBaseInfo templetBaseInfo) {
        int i=0;
        if(templetBaseInfo.getExtendInfoObjectList().size()>0) {
            for(int j=0;j<templetBaseInfo.getExtendInfoObjectList().size();j++) {
                XzTempletExtendInfo templetExtendInfo=templetBaseInfo.getExtendInfoObjectList().get(j);
                templetExtendInfo.setTempletBaseInfoId(templetBaseInfo.getTempletBaseInfoId());
                i = xzTempletExtendInfoMapper.insert(templetExtendInfo);
            }
        }
        return i;
    }
    //撤回申请（删除基本实例表的方法）
    @Override
    public int phoneyDeleteByPrimaryKey(XzTempletExtendInfo templetExtendInfo) {
        int i=0;
        i=xzTempletExtendInfoMapper.phoneyDeleteByPrimaryKey(templetExtendInfo);
        return i;
    }

    //根据模板ID查询扩展实例表中的信息
    @Override
    public List<XzTempletExtendInfo> selectByPrimaryKey(Long templetBaseInfoId) {
        List<XzTempletExtendInfo>  templetExtendInfoList=xzTempletExtendInfoMapper.selectByPrimaryKey(templetBaseInfoId);
        return templetExtendInfoList;
    }
}
